package com.biannuo.szk.common.generator.datasource;

import com.baomidou.mybatisplus.generator.FastAutoGenerator;

import java.sql.SQLException;

public class DsGenerator {
    public static final String URL = "jdbc:mysql://192.168.200.33:13306/spider?useSSL=false&useUnicode=true&characterEncoding=UTF-8&serverTimezone=UTC";
   /*new DataSourceConfig.Builder("jdbc:mysql://192.168.200.33:13306/spider?useUnicode=true&characterEncoding=utf8&useSSL=false&useLegacyDatetimeCode=false&serverTimezone=Asia/Shanghai","root","grid@123!#")
                .dbQuery(new MySqlQuery())
                .schema("spider")
                .typeConvert(new MySqlTypeConvert())
                .keyWordsHandler(new MySqlKeyWordsHandler())
                .build();*/

    /**
     * 执行 run
     */
    public static void main(String[] args) throws SQLException {
        String userDir = System.getProperty("user.dir");
        // 指定输出目录
        String outFile = userDir + "/files/mybatis-plus/java";
        String outMapperFile = userDir + "/files/mybatis-plus/mapper";

        FastAutoGenerator.create(URL, "root", "grid@123!#")
                // 全局配置
                .globalConfig(builder -> builder.outputDir(outFile))
                // 策略配置
                .strategyConfig(builder -> builder.addInclude("sample"))
                // 执行
                .execute();
    }
}
